<?php

namespace IDock\Insurance\DAJIA\Request;

use IDock\Insurance\DAJIA\Request\AllDAJIARequest;
use IDock\Insurance\DAJIA\Response\VehicleModelResponse;
use IDock\Visitor\VehicleModelVisitor;

/**
 * 车型查询接口
 */
class VehicleModelRequest extends AllDAJIARequest
{
    protected $code = 'ODR2009';

    protected $response = VehicleModelResponse::class;

    protected $urlTip = '车辆车型查询';

    public $switch = true;

    /**
     * @var VehicleModelVisitor $visitor
     */
    protected $visitor;

    public function generate(): array
    {
        //if (!$this->switch) {
        //    $modelName = preg_replace('/[\x{4e00}-\x{9fa5}]+(-[\x{4e00}-\x{9fa5}])?/u','',$this->visitor->vehicleModel);
        //} else {
            $modelName = $this->visitor->vehicleModel;
        //}

        return [
            'orderNo' => $this->visitor->argc['orderNo'] ?? '',
            'vehicleName' => $modelName,
            'vin' => $this->visitor->vin,
            'licensePlateNo' => $this->visitor->licenseNo,
            'engineNo' => $this->visitor->engineNo,
            'cDptCde' => $this->visitor->argc['cDptCde'] ?? '',
            'vehicleIdList' => $this->visitor->argc['vehicleIdList'] ?? [],
        ];
    }
}
